package com.zzs.client.service.impl;

import com.zzs.client.dao.redis.ProblemCodeCacheManager;
import com.zzs.client.pojo.vo.ProblemCodeVO;
import com.zzs.client.service.ProblemCodeService;
import com.zzs.common.core.entity.redis.ProblemCodeCache;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author zzs
 * @date 2025/03/27
 */
@Service
public class ProblemCodeServiceImpl implements ProblemCodeService {
    @Autowired
    private ProblemCodeCacheManager problemCodeCacheManager;

    @Override
    public ProblemCodeVO getProblemCode(long problemId, int language) {
        ProblemCodeCache problemCodeCache = problemCodeCacheManager.getProblemCodeCache(problemId, language);
        ProblemCodeVO problemCodeVO = new ProblemCodeVO();
        BeanUtils.copyProperties(problemCodeCache, problemCodeVO);
        return problemCodeVO;
    }
}
